package com.bsoft.gol.hbs.healthinfo.state;


import com.bsoft.gol.hbs.bean.enums.ArticleStatusEnum;
import com.bsoft.gol.hbs.healthinfo.AbstractState;
import com.bsoft.gol.hbs.healthinfo.State;

/**
 * 已发布状态
 *
 * @author linyi
 * @date 2021/10/13 17:40
 */
public class ReleasedState extends AbstractState {
    public ReleasedState() {
        super(ArticleStatusEnum.RELEASED.getState());
    }

    @Override
    public boolean forwardNext() {
        return false;
    }

    @Override
    public boolean forwardPrev() {
        System.out.println("当前为已发布状态,上一个节点状态为已提交");
        return true;
    }

    @Override
    public State getNext() {
        setErrorMessage("当前为已发布状态,无法流转至下一个状态");
        return null;
    }

    @Override
    public State getPrev() {
        return new SubmittedState();
    }

}
